package com.mgg.payment.service.account;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.mgg.common.dto.CouponDTO;
import com.mgg.common.dto.OrderDTO;
import com.mgg.common.vo.AccountVO;
import com.mgg.payment.vo.BankVO;
import com.mgg.payment.vo.WithdrawalsRecordVO;
import org.springframework.data.domain.Pageable;

public interface AccountService {

	/**
	 * 获取账户
	 * @param userId
	 * @return
	 */
	AccountVO getAccountByUserId(String userId);

    /**
     * 修改账户金额
     * @param userId
     * @param totalIncome
     * @param amount
     * @param preAmount
     * @param type
     * @param orderId
     * @param remark
     */
	void updateAccount(String userId, BigDecimal totalIncome, BigDecimal amount, BigDecimal preAmount, Integer type, String orderId, String remark);

    /**
     * 记录用户账户修改日志
     * @param userId
     * @param amount
     * @param preAmount
     * @param type
     * @param orderId
     * @param remark
     */
	void insertAccountLog(String userId, BigDecimal amount, BigDecimal preAmount, Integer type, String orderId, String remark);

    Map<String,Object> listAccountAmountDetail(String userId, Pageable page);

    Map<String,Object> listAccountPreAmountDetail(String userId, Pageable page);

    /**
     * 银行列表
     * @return
     */
    List<BankVO> listBank();

    /**
     * 提现
     * @param userId
     * @param amount
     * @param type
     * @param name
     * @param account
     * @param bank
     */
    void insertWithdrawals(String userId, BigDecimal amount, String type, String name, String account, String bank);

    /**
     * 提现明细列表
     * @param userId
     * @param page
     * @return
     */
    List<WithdrawalsRecordVO> listWithdrawalsRecord(String userId, Pageable page);

    /**
     * 通过类型获取美币，优惠券
     * @param type
     * @param subType
     * @return
     */
    CouponDTO getCouponByType(String type, String subType);

    /**
     * 通过ID获取美币，优惠券
     * @param couponId
     * @return
     */
    CouponDTO getCouponById(String couponId);

    /**
     * 发放美币，优惠券
     * @param userId
     * @param coupon
     * @param num
     * @param starttime
     * @throws Exception
     */
    void insertUserCoupon(String userId, CouponDTO coupon, Integer num, String starttime);

    /**
     * 记录用户返利收益日志
     * @param userId
     * @param orderId
     * @param rebateMoney
     * @param rebateRatio
     * @param income
     * @param shopCode
     * @param status
     * @param type
     * @param remark
     * @return
     */
    Integer insertShopOrderRebateRecord(String userId, String orderId, BigDecimal rebateMoney, double rebateRatio, BigDecimal income, String shopCode, String status, String type, String remark);

    /**
     * 插入工资明细
     * @param userId
     * @param sourceUser
     * @param amount
     * @param type
     * @param status
     * @param orderId
     * @param remark
     * @return
     */
    Integer insertSalaryDetails(String userId, String sourceUser, BigDecimal amount, String type, String status, String orderId, String remark);

    Map<String, String> getTransferByNo(String transferNo, String type, String status);

    void updateTransfer(String transferNo, String orderNo, String auditedtime, String payDate, int status, String remark);

    void allocateRebateAmount(OrderDTO order);

	void processesRegistShopkeeperOrder(String userId, OrderDTO order);

	void sendRegistShopkeeperOrderRebate(OrderDTO order, String userId, Integer orderType, Integer userType);

    void updateShopSales(OrderDTO order);
}
